namespace CShipBasic.oop;

public class Employee
{
    public float salary = 40000;
    public Address address; // Employee HAS-A Address
    public int age = 30;

    public Employee(float salary, Address address)
    {
        this.salary = salary;
        this.address = address;
    }
    public Employee(){}

    public void Eat()
    {
        Console.WriteLine("吃的什么饭？");
    }

    public void Eat(string username)
    {
        Console.WriteLine("{0}你好，请问今天吃的什么饭？", username);
    }

    /// <summary>
    /// C#中的重载，需要注意下：方法请求参数必须不一样， 不支持请求参数相同且返回类型不同的场景
    /// </summary>
    /// <param name="amount"></param>
    /// 比如：使用以下方法就会报错
    // public string Eat(string username)
    // {
    //     return "test";
    // }
    public void Eat(int amount)
    {
        Console.WriteLine("今天收入为：{0}元", amount);
    }
    
    /// <summary>
    /// 用来测试方法覆盖
    /// </summary>
    /// <param name="isEat"></param>
    public virtual void Eat(bool isEat)
    {
        if (isEat)
        {
            Console.WriteLine("我是Employee，今天准备一起去吃饭");
        }
        else
        {
            Console.WriteLine("我是Employee，不饿，今天不去吃饭了");
        }
       
    }

    public void PrintInfo()
    {
        Console.WriteLine("当前薪资为：{0}, 住址为：{1}{2}{3}", salary,address.country,address.state,address.city);
    }
}